<html>
<head><meta charset="utf-8"><title>captures attribute · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/captures.20attribute.html">captures attribute</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228674272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/captures%20attribute/near/228674272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/captures.20attribute.html#228674272">(Mar 03 2021 at 21:46)</a>:</h4>
<p>So I think we should do this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[captures(x, y, z)]</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">z</span><span class="p">.</span><span class="mi">2</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="228674342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/captures%20attribute/near/228674342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/captures.20attribute.html#228674342">(Mar 03 2021 at 21:46)</a>:</h4>
<p>this would be a procedural macro that expands to <code>let _ = &amp;(x, y, z);</code></p>



<a name="228674665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/captures%20attribute/near/228674665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/captures.20attribute.html#228674665">(Mar 03 2021 at 21:48)</a>:</h4>
<p>possible problem:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[captures]</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{}</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
</code></pre></div>



<a name="228674828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/captures%20attribute/near/228674828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/captures.20attribute.html#228674828">(Mar 03 2021 at 21:50)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=cfd1865362f85b345cb740b1980bc680">this doesn't build</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>